package ua.com.infopulse.believeornevers.data;

public class Question {
	public String question;
	public boolean state;

	public Question(String question, boolean state) {
		this.question = question;
		this.state = state;
	}

	public static Question getInstance(String question){
		if (question.contains("|")) {
			int position = question.lastIndexOf("|");
			String questionWithoutAnswer= question.substring(0, position - 1);
			String stringState = question.substring(position + 1);
			boolean state= Boolean.parseBoolean(stringState.trim());
			return new Question(questionWithoutAnswer, state); 
		} else {
			return null;
		}
		
	}
}
